﻿<div class="row">
    <div class="form-inline pull-left">
        <div class="input-group">
            <span class="input-group-addon">常规视图</span>
            <label class="el-switch">
                <input type="checkbox" name="switch">
                <span class="el-switch-style" ng-click="aclMode=!aclMode"></span>
            </label>
            <span class="input-group-addon">权限控制视图</span>
        </div>
    </div>
    <div class="form-inline pull-right">
        <button class="btn btn-info waves-effect" ng-click="list.GetPageData(paginationConf.currentPage, paginationConf.itemsPerPage);">
            <span class="glyphicon glyphicon-refresh"></span>
        </button>
        <div class="input-group">
            <span class="input-group-addon">全局搜索：</span>
            <div class="fg-line">
                <input type="text" class="form-control" ng-change="search(kw)" ng-model="kw" placeholder="全局搜索" />
            </div>
        </div>
        <div class="input-group">
            <span class="input-group-addon">分类：</span>
            <div class="ui search selection dropdown category">
                <input name="category" type="hidden" id="category">
                <i class="dropdown icon"></i>
                <div class="default text">请选择分类</div>
                <div class="menu">
                    <div class="item" data-value="">无</div>
                    <div class="item" ng-repeat="item in cat track by $index" data-value="{{item.Id}}">{{item.Name}}</div>
                </div>
            </div>
        </div>
        <div class="input-group">
            <span class="input-group-addon">服务端排序方式：</span>
            <div class="ui selection dropdown orderby">
                <input name="gender" type="hidden" value="default">
                <i class="dropdown icon"></i>
                <div class="text">最后修改</div>
                <div class="menu">
                    <div class="item" data-value="0">发表时间</div>
                    <div class="item" data-value="1">最后修改</div>
                    <div class="item" data-value="2">访问量最多</div>
                    <div class="item" data-value="4">支持数最多</div>
                    <div class="item" data-value="5">每日平均访问量</div>
                </div>
            </div>
        </div>
    </div>
    <table ng-table="list.tableParams" class="table table-striped table-vmiddle table-bordered table-hover table-condensed">
        <tr ng-repeat="row in $data">
            <td data-title="'标题'">
                <a ng-href="/{{row.Id}}" target="_blank">{{row.Title}}</a>
            </td>
            <td data-title="'作者'">
                <a ng-href="/author/{{row.Author}}" target="_blank">{{row.Author}}</a>
            </td>
            <td data-title="'作者邮箱'">
                {{row.Email}}
            </td>
            <td data-title="'阅读'" ng-if="!aclMode">
                {{row.ViewCount}}
            </td>
            <td data-title="'在看'" ng-if="!aclMode">
                {{row.Online}}
            </td>
            <td data-title="'发表'" ng-if="!aclMode">
                {{row.PostDate|date:'yyyy-MM-dd HH:mm'}}
            </td>
            <td data-title="'修改'">
                {{row.ModifyDate|date:'yyyy-MM-dd HH:mm'}}
            </td>
            <td title="'修改次数'" ng-if="!aclMode">
                {{row.ModifyCount}}
            </td>
            <td data-title="'分类'">
                {{row.CategoryName}}
            </td>
            <td data-title="'标签'" style="max-width: 160px;" ng-if="!aclMode">
                {{row.Label}}
            </td>
            <td data-title="'支持'" ng-if="!aclMode">
                {{row.VoteUpCount}}
            </td>
            <td data-title="'状态'">
                {{row.Status}}
            </td>
            <td data-title="'是否限区'" ng-if="aclMode">
                {{row.LimitDesc}}
            </td>
            <td data-title="'禁止评论'" ng-if="aclMode">
                <label class="el-switch">
                    <input type="checkbox" name="switch" ng-checked="row.DisableComment">
                    <span class="el-switch-style" ng-click="toggleDisableComment(row)"></span>
                </label>
            </td>
            <td data-title="'禁止转载'" ng-if="aclMode">
                <label class="el-switch">
                    <input type="checkbox" name="switch" ng-checked="row.DisableCopy">
                    <span class="el-switch-style" ng-click="toggleDisableCopy(row)"></span>
                </label>
            </td>
            <td data-title="'开启Rss'" ng-if="aclMode">
                <label class="el-switch">
                    <input type="checkbox" name="switch" ng-checked="row.Rss">
                    <span class="el-switch-style" ng-click="rssSwitch(row.Id)"></span>
                </label>
            </td>
            <td data-title="'锁定编辑'" ng-if="aclMode">
                <label class="el-switch">
                    <input type="checkbox" name="switch" ng-checked="row.Locked">
                    <span class="el-switch-style" ng-click="lockedSwitch(row.Id)"></span>
                </label>
            </td>
            <td data-title="'操作'" style="width: 195px;">
                <div class="btn-group">
                    <button class="btn btn-default btn-sm waves-effect" ng-click="list.pass(row)" ng-if="row.Status=='审核中'">
                        <i class="icon-checkmark"></i>
                    </button>
                    <a class="btn btn-success btn-sm waves-effect" ng-href="#/post/edit?id={{row.Id}}">
                        <i class="icon-pencil"></i>
                    </a>
                    <a class="btn btn-info btn-sm waves-effect" ng-href="#/writeblog?refer={{row.Id}}">
                        <i class="zmdi zmdi-copy zmdi-hc-fw"></i>
                    </a>
                    <button class="btn btn-danger btn-sm waves-effect" ng-click="list.del(row)" ng-if="row.Status!='已删除'">
                        <i class="icon-bin"></i>
                    </button>
                    <a class="btn btn-danger btn-sm waves-effect" ng-click="list.truncate(row)" ng-if="row.Status=='已删除'">
                        <i class="icon-cross"></i>
                    </a>
                    <a class="btn btn-info btn-sm waves-effect" ng-click="list.restore(row)" ng-if="row.Status=='已删除'">
                        <i class="icon-undo2"></i>
                    </a>
                    <a class="btn  btn-sm waves-effect" ng-class="{true:'btn-success',false:'btn-primary'}[row.IsFixedTop]" ng-click="list.fixtop(row.Id)" ng-if="row.Status!='已删除'">
                        <i class="icon-pushpin" ng-class="{true:'text-danger'}[row.IsFixedTop]"></i>
                    </a>
                    <a class="btn btn-info btn-sm waves-effect" ng-click="list.insight(row)">
                        <i class="icon-chart"></i>
                    </a>
                </div>
            </td>
        </tr>
    </table>
    <tm-pagination conf="paginationConf"></tm-pagination>
</div>
<div class="row">
    <div class="col-md-6" ng-if="agg.trending.length>0">
        <div class="page-header">
            <h3 class="text-center">今日热榜</h3>
        </div>
        <table class="table table-bordered table-condensed table-responsive">
            <thead>
                <tr>
                    <th style="min-width: 40px">序号</th>
                    <th>标题</th>
                    <th style="min-width: 60px">今日访问量</th>
                </tr>
            </thead>
            <tbody>
                <tr ng-repeat="item in agg.trending">
                    <td>{{$index+1}}</td>
                    <td><a ng-href="/{{item.Id}}" target="_blank">{{item.Title}}</a></td>
                    <td>{{item.ViewCount}}</td>
                </tr>
            </tbody>
        </table>
    </div>
    <div class="col-md-6" ng-if="agg.mostHots.length>0">
        <div class="page-header">
            <h3 class="text-center">当前在看排行榜</h3>
        </div>
        <table class="table table-bordered table-condensed table-responsive">
            <thead>
                <tr>
                    <th style="min-width: 40px">序号</th>
                    <th>标题</th>
                    <th style="min-width: 80px">在看人数</th>
                </tr>
            </thead>
            <tbody>
                <tr ng-repeat="item in agg.mostHots">
                    <td>{{$index+1}}</td>
                    <td><a ng-href="/{{item.Id}}" target="_blank">{{item.Title}}</a></td>
                    <td>{{item.ViewCount}}</td>
                </tr>
            </tbody>
        </table>
    </div>
    <div class="col-md-6" ng-if="agg.mostAverage.length>0">
        <div class="page-header">
            <h3 class="text-center">日均访问量排行榜</h3>
        </div>
        <table class="table table-bordered table-condensed table-responsive">
            <thead>
                <tr>
                    <th style="min-width: 40px">序号</th>
                    <th>标题</th>
                    <th style="min-width: 60px">日均访问量</th>
                </tr>
            </thead>
            <tbody>
                <tr ng-repeat="item in agg.mostAverage">
                    <td>{{$index+1}}</td>
                    <td><a ng-href="/{{item.Id}}" target="_blank">{{item.Title}}</a></td>
                    <td>{{item.ViewCount}}</td>
                </tr>
            </tbody>
        </table>
    </div>
    <div class="col-md-6" ng-if="agg.mostView.length>0">
        <div class="page-header">
            <h3 class="text-center">访问量最高排行榜</h3>
        </div>
        <table class="table table-bordered table-condensed table-responsive">
            <thead>
                <tr>
                    <th style="min-width: 40px">序号</th>
                    <th>标题</th>
                    <th style="min-width: 60px">访问量</th>
                </tr>
            </thead>
            <tbody>
                <tr ng-repeat="item in agg.mostView">
                    <td>{{$index+1}}</td>
                    <td><a ng-href="/{{item.Id}}" target="_blank">{{item.Title}}</a></td>
                    <td>{{item.ViewCount}}</td>
                </tr>
            </tbody>
        </table>
    </div>
</div>